package com.ecsolutions.dao.liability;

import com.ecsolutions.entity.liability.LiabilityEntity;
import com.ecsolutions.entity.liability.LoanTypeEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by Administrator on 2017/5/15.
 */
public interface LiabilityDao {
    @Select("select balance_currency, sum(balance) balance_sum from \n" +
            "(select * from LOAN_ACCOUNT_INFO where trim(Customer_Code) = trim(#{customer_code}))\n" +
            " group by balance_currency\n")
    @ResultType(LiabilityEntity.class)
    List<LiabilityEntity> getCurrencies(@Param("customer_code") String customer_code);

    @Select("select loan_type type,sum(balance) balance_sum from \n" +
            "(select * from LOAN_ACCOUNT_INFO where trim(Customer_Code) = trim(#{customer_code}) and trim(balance_currency) = trim(#{currency}) )\n" +
            "group by loan_type\n")
    @ResultType(LoanTypeEntity.class)
    List<LoanTypeEntity> getLoanTypes(@Param("customer_code") String customer_code, @Param("currency") String currency);
}
